package com.kaifamiao.dispatch;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Logger;

@WebServlet( "/zhu/ge/liang" )
public class ZhuGeLiangServlet extends HttpServlet {

    private Logger logger = Logger.getLogger( this.getClass().getName() );

    @Override
    protected void service(HttpServletRequest request , HttpServletResponse response )
            throws ServletException, IOException {
        logger.info( "接受到浏览器的请求" );
        request.setCharacterEncoding( "UTF-8" );
        response.setCharacterEncoding( "UTF-8" );

        String letter = request.getParameter( "letter" );
        logger.info( "接受到的参数: " + letter );

        response.setContentType( "text/html;charset=UTF-8" );

        PrintWriter out = response.getWriter();

        out.println( "<div>" );
        out.println( "亮亮开心地去小备的公司上班了" );
        out.println( "</div>" );

    }

}
